<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
<title>门诊二类苗进销存管理</title>
<meta name="decorator" content="default"/>
<script src="${ctxStatic}/common/change/change.js"></script>
<script type="text/javascript">
$(document).ready(function() {
	initVaccName(expSecondjxc.companyCode,expSecondjxc.vaccineId);
	initVaccCompanyName(expSecondjxc.companyCode);
	$(".vaccineCompany").change(function(){
		var vaccId = $(this).val();
		initCompanyName($(this).val());
		if(vaccId == ""){
			initVaccCompanyName("");
		}
	});
	$(document).on("click","#btnReset",function(){
		$("#vaccineId").val("").select2();
		$("#companyCode").val("").select2();
		$("#batch").val("");
		$("#beginDate").val("");
		$("#endDate").val("");
		$("#localCodeId").val("");
		$("#localCodeName").val("");
	})
	$(document).on("click","#btnPrint",function(){
		top.$.jBox.confirm("确认要导出门诊二类苗进销存数据吗？","系统提示",function(v,h,f){
			if(v=="ok"){
				$("#searchForm").attr("action","${ctx}/expSecondjxc/expVacc/export");
				$("#searchForm").submit();
			}
			$("#searchForm").attr("action","${ctx}/expSecondjxc/expVacc/list");
		},{buttonsFocus:1});
		top.$('.jbox-body .jbox-icon').css('top','55px');
	})
});
var expSecondjxc = JSON.parse('${fns:toJson(expSecondjxc)}');
function page(n,s){
	$("#pageNo").val(n);
	$("#pageSize").val(s);
	$("#searchForm").submit();
    return false;
}
</script>
<style type="text/css">		
	#contentTable td ,#contentTable th{
		text-align: center;
		padding:2px 0px;
	}
	#contentTable tbody tr td{
		font-size: 13px;
		line-height: 25px;
	}
	#contentTable th {
	    text-align: center;
	    vertical-align: middle;
    }
</style>
</head>
<body>
	<ul class="nav nav-tabs">
		<li><a href="${ctx}/area/vaccinate/stockAndSalesList">疫苗进销存</a></li>
		<li class="active"><a href="${ctx}/expSecondjxc/expVacc">门诊二类苗进销存</a></li>
	</ul>
	<form:form id="searchForm" modelAttribute="expSecondjxc" action="${ctx}/expSecondjxc/expVacc/list" method="post" class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
		<table class="table table-bordered">
			<tr>
			    <th>疫苗名称：</th>
				<td>
					<form:select path="vaccineId" id="vaccineId" class="span2 minWidth vaccineCompany" >
						<form:option value=""  label="--请选择--"/>
					</form:select>
				</td>
				<th>疫苗厂家：</th>
				<td>
					<form:select path="companyCode" id="companyCode" class="span2 minWidth changeCompany vaccCompanyName">
						<form:option value="" label="--请选择--"/> 
					</form:select>
				</td>
			    <th>疫苗批号</th>
				<td>
					<form:input path="batch" id="batch" htmlEscape="false" maxlength="20" class="input-medium"/>
				</td>
			</tr>
			<tr>
			    <th>地区：</th>
			    <td>
					<sys:treeselect2 id="localCode" name="localCode" value="${expSecondjxc.localCode}" labelName="localName" labelValue="${expSecondjxc.localName}"
					title="机构" url="/sys/office/treeData" extId="${office.id}" cssClass="input-medium" allowClear="${office.currentUser.admin}" layer = "true" notAllowSelectParent="true" notAllowSelectRoot="true"/>
				</td>
				<th>报表起始月份：</th>
				<td>
					<input name="beginDate" id="beginDate" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate"
						value="<fmt:formatDate value="${expSecondjxc.beginDate}" pattern="yyyy-MM-dd"/>"
						onclick="WdatePicker({dateFmt:'yyyy-MM',isShowClear:true});"/>
				</td>
				<th>报表截止月份：</th>
				<td>
					<input name="endDate" id="endDate" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate"
						value="<fmt:formatDate value="${expSecondjxc.endDate}" pattern="yyyy-MM-dd"/>"
						onclick="WdatePicker({dateFmt:'yyyy-MM',isShowClear:true});"/>
				</td>
			</tr>
		</table>

		<div>
			<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
			<input id="btnReset" class="btn btn-primary" type="button" value="重置"/>
			<input id="btnPrint" class="btn btn-primary" type="button" value="导出"/> 
		</div>
	</form:form>
	<sys:message content="${message}"/>
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead>
			<tr>
				<th rowspan="4">疫苗名称</th>
				<th rowspan="4">规格</th>
				<th rowspan="4">生产企业</th>
				<th rowspan="4">批号</th>
				<th rowspan="4">有效期</th>
				<th rowspan="4">成本价</th>
				<th rowspan="2" colspan="3">期初库存</th>
				<th colspan="16">本期发生</th>
				<th rowspan="2" colspan="3">期末库存</th>
			</tr>
			<tr>
			    <th colspan="4">入库/领取</th>
				<th colspan="12">出库</th>
			</tr>
			<tr>
			    <th rowspan="2">实际库存<br>(含预售)</th>
				<th colspan="2">可用库存</th>
				<th rowspan="2">领取</th>
				<th rowspan="2">退回<br>上级</th>
				<th rowspan="2">领取<br>合计</th>
				<th rowspan="2">入库<br>金额</th>
				<th rowspan="2">上期预售<br>本期使用</th>
				<th colspan="3">本期出库单价1</th>
				<th colspan="3">本期出库单价2</th>
				<th rowspan="2">报损</th>
				<th rowspan="2">接种/使<br>用合计</th>
				<th rowspan="2">本期销<br>售数量</th>
				<th rowspan="2">本期销<br>售成本</th>
				<th rowspan="2">本期消<br>费金额</th>
				<th rowspan="2">实际库存<br>(含预售)</th>
				<th colspan="2">可用库存</th>
			</tr>
			<tr>
			    <th>数量</th>
				<th>金额</th>
				<th>价格</th>
				<th>使用量</th>
				<th>预售量</th>
				<th>价格</th>
				<th>使用量</th>
				<th>预售量</th>
				<th>数量</th>
				<th>金额</th>
			</tr>
		</thead>
		<tbody>
		<c:forEach items="${page.list}" var="expSecondjxc">
			<tr>
				<td>
					${expSecondjxc.vaccineName}
				</td>
				<td>
					${expSecondjxc.dosage}
				</td>
				<td>
					${expSecondjxc.companyName}
				</td>
				<td>
					${expSecondjxc.batch}
				</td>
				<td>
					${expSecondjxc.expdate}
				</td>
				<td>
					￥${expSecondjxc.costprice}
				</td>
				<td>
					${expSecondjxc.lastalCount}
				</td>
				<td>
					${expSecondjxc.lastvaCount}
				</td>
				<td style = "text-align: right; padding-right: 10px">
					￥${expSecondjxc.lastvaMoney}
				</td>
				<td>
					${expSecondjxc.incomeCount}
				</td>
				<td>
					${expSecondjxc.refundCount}
				</td>
				<td>
					${expSecondjxc.incomesum}
				</td>
				<td>
					￥${expSecondjxc.incomeMoney}
				</td>
				<td>
					${expSecondjxc.paiduse}
				</td>
				<td style = "text-align: right; padding-right: 10px">
					￥${expSecondjxc.vaccPricefir}
				</td>
				<td>
					${expSecondjxc.countfir}
				</td>
				<td>
					${expSecondjxc.wcountfir}
				</td>
				<td style = "text-align: right; padding-right: 10px">
					￥${expSecondjxc.vaccPricesec}
				</td>
				<td>
					${expSecondjxc.countsec}
				</td>
				<td>
					${expSecondjxc.wcountsec}
				</td>
				<td>
					${expSecondjxc.brokenCount}
				</td>
				<td>
					${expSecondjxc.vaccsum}
				</td>
				<td>
					${expSecondjxc.sellcount}
				</td>
				<td style = "text-align: right; padding-right: 10px">
					￥${expSecondjxc.sellCost}
				</td>
				<td style = "text-align: right; padding-right: 10px">
					￥${expSecondjxc.sellMoney}
				</td>
				<td>
					${expSecondjxc.alcount}
				</td>
				<td >
					${expSecondjxc.vacount}
				</td>
				<td style = "text-align: right; padding-right: 10px">
					￥${expSecondjxc.vamoney}
				</td>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
</body>
</html>